package com.lorenzogao.pley.ui.activity

import com.lorenzogao.pley.R
import com.lorenzogao.pley.bean.Category
import com.lorenzogao.pley.common.Constant
import com.lorenzogao.pley.ui.adapter.CategoryAppViewPagerAdapter
import com.lorenzogao.pley.ui.base.BaseActivity
import com.lorenzogao.pley.ui.di.component.AppComponent
import com.lorenzogao.pley.ui.presenter.BasePresenter
import kotlinx.android.synthetic.main.app_bar_main.*

class CategoryAppActivity : BaseActivity<BasePresenter<*, *>>() {




    private lateinit var category: Category

    override fun setLayout(): Int {
        return R.layout.activity_category_app
    }

    override fun initData() {

    }

    override fun initView() {
        getData()
        initTabLayout()
    }

    override fun setupActivityComponent(appComponent: AppComponent) {

    }

    private fun initTabLayout() {

        var mAdapter = CategoryAppViewPagerAdapter(supportFragmentManager, category.id)
        view_pager.adapter = mAdapter
        view_pager.offscreenPageLimit = mAdapter.count
        tab_layout.setupWithViewPager(view_pager)


    }

    private fun getData() {

        category = intent.getSerializableExtra(Constant.CATEGORY) as Category
    }

}
